[C++] Start a thread using a method pointer
Posted
by
Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-12-21T20:30:57Z
Indexed on
2010/12/21
20:54 UTC
Read the original article
Hit count: 145
Hi !
I'm trying to develop a thread abstraction (POSIX thread and thread from the Windows API), and I would very much like it to be able to start them with a method pointer, and not a function pointer.
What I would like to do is an abstraction of thread being a class with a pure virtual method "runThread", which would be implanted in the future threaded class.
I don't know yet about the Windows thread, but to start a POSIX thread, you need a function pointer, and not a method pointer. And I can't manage to find a way to associate a method with an instance so it could work as a function. I probably just can't find the keywords (and I've been searching a lot), I think it's pretty much what Boost::Bind() does, so it must exist.
Can you help me ?
© Stack Overflow or respective owner